<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/css/Style1.css"
	rel="stylesheet" type="text/css" />
<link
	href="${ pageContext.request.contextPath }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet">
<script type="text/javascript"
	src="${ pageContext.request.contextPath }/static/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
	function fu() {
		window.location.href = "${pageContext.request.contextPath}/admin/order/list.jsp";
	}
	function selDetails(oid){
		window.location.href = "${pageContext.request.contextPath}/admin/orderDetails.action?oid="+oid;
	}
</script>
</head>
<body>
	<div align="right" style="margin-top: 20px; padding-right: 70px;">
		<input type="button" class="btn btn-success"
					onclick="history.go(-1)" value="返回" />
	</div>
	<div style="width: 93%; margin-left: 38px;">
		<form style="margin-top: 10px;">
			<table width="100%" align="center" id="table"
				class="table table-hover table-bordered table-striped">
				<thead>
					<tr align="center" bgcolor="#93b6bd" height="34">
						<td align="center" width="5%">序号</td>
						<td align="center" width="7%">订单编号</td>
						<td align="center" width="8%">订单金额</td>
						<td align="center" width="8%">收货人</td>
						<td align="center" width="18%">收货地址</td>
						<td align="center" width="8%">订单状态</td>
						<td align="center" width="50%">订单详情</td>
					</tr>
				</thead>
				<tbody></tbody>
				<!-- 循环遍历 -->
				<c:forEach items="${orders}" var="o" varStatus="status">
					<tr onmouseover="this.style.backgroundColor = 'white'"
						onmouseout="this.style.backgroundColor = '#F5FAFE';" onclick="selDetails(${o.oid})">
						<td style="CURSOR: hand; HEIGHT: 40px" align="center" width="5%">${status.count}</td>
						<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="5%">${o.oid}</td>
						<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="5%">${o.money}</td>
						<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="8%">${o.accepter}</td>
						<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="18%">${o.receiveinfo}</td>
						<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="10%"><c:if
								test="${o.state==0}">
													未付款
												</c:if> <c:if test="${o.state==1}">
													已付款，<a
									href="${ pageContext.request.contextPath }/admin/adminOrder_updateState.action?oid=${o.oid}&status=2"><font
									color="blue">发货</font></a>
							</c:if> <c:if test="${o.state==2}">
													等待确认收货
												</c:if> <c:if test="${o.state==3}">
													订单完成
												</c:if></td>
						<td align="center" style="HEIGHT: 22px">
							<div id="div${o.oid}">
								<table width="100%">
									<c:forEach items="${o.oiList}" var="orderItem">
										<tr>
											<td><img width="40" height="45"
												src="${ pageContext.request.contextPath }/${orderItem.product.image}"></td>
											<td>商品名称：${orderItem.product.pname}</td>
											<td>商品数量：${orderItem.count}</td>
											<td>商品总价：${orderItem.subtotal}</td>
										</tr>
									</c:forEach>
								</table>
							</div>
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</div>
</body>
</html>